
//#define TEST_DirectoryCursor
#ifdef TEST_DirectoryCursor

#include "Win32.IO.DirectoryCursor.h"
#include "Win32.IO.File.h"

void main()
{
   bool verbose = false;

   Kif::Win32::IO::DirectoryCursor *pC;
   long i,cnt=0;
   for (i=0; i < 10; i++)
   {
      pC = new Kif::Win32::IO::DirectoryCursor();
      if (pC->Open(_T("c:/temp/*")))
      {
         while (pC->Next())
         {
            if (pC->IsDirectory())
               if (verbose)
                  _tprintf(L"Directory: %s\n",pC->GetCurrentDirectoryEntryName());
            else
               if (verbose)
                  _tprintf(L"     File: %s\n",pC->GetCurrentDirectoryEntryName());
         }
         pC->Close();
      }

      if (cnt == 10000)
      {
         _tprintf(L"%d\n",cnt);
         cnt = 0;
      }
      else
         cnt++;
      delete pC;
   }

   verbose = false;
   Kif::Win32::IO::DirectoryCursor c;
   cnt=0;
   for (i=0; i < 1000000; i++)
   {
      if (c.Open(_T("c:/temp/*")))
      {
         while (c.Next())
         {
            if (c.IsDirectory())
               if (verbose)
                  _tprintf(L"Directory: %s\n",c.GetCurrentDirectoryEntryName());
            else
               if (verbose)
                  _tprintf(L"     File: %s\n",c.GetCurrentDirectoryEntryName());
         }
         c.Close();
      }

      if (cnt == 10000)
      {
         _tprintf(L"%d\n",cnt);
         cnt = 0;
      }
      else
         cnt++;
   }
}

#endif
